package org.ndot.java.util.concurrent.bank.ThreadPool;

import java.io.Serializable;

import org.ndot.java.util.concurrent.bank.BankParam;
import org.ndot.java.util.concurrent.bank.Consumer;

/**
 * 
 * @公司:小蚂蚁学堂
 * 
 * @日期:2010-4-14上午09:07:33
 * 
 * @项目名称:J2SE_Study
 * 
 * @类名称:org.ndot.java.util.concurrent.bank.ThreadPool.Operator.java
 * 
 * @作者:SunJincheng
 * 
 * @版本:1.0
 * 
 */
public class Operator implements Runnable, Serializable {

	/**
	 * . serialVersionUID long
	 */
	private static final long serialVersionUID = 1L;
	private Consumer consumer;

	public Operator(Consumer consumer) {
		this.consumer = consumer;
	}

	public void run() {
		doBusiness(consumer);
	}

	private void doBusiness(Consumer cnosumer) {
		try {
			Thread.sleep(cnosumer.getTime() * 100);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println(Thread.currentThread().getName() + "-->已经完成 第"
				+ cnosumer.getId() + "个"
				+ BankParam.printInfo(cnosumer.getType()) + "类型客户业务处理...");
	}
}
